/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package EA_Model.IEC61970.Protection.impl;

import EA_Model.IEC61970.Core.impl.EquipmentImpl;

import EA_Model.IEC61970.Domain.Seconds;
import EA_Model.IEC61970.Domain.UnitMultiplier;
import EA_Model.IEC61970.Domain.UnitSymbol;

import EA_Model.IEC61970.Protection.ProtectionEquipment;
import EA_Model.IEC61970.Protection.ProtectionPackage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Equipment</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link EA_Model.IEC61970.Protection.impl.ProtectionEquipmentImpl#getHighLimit <em>High Limit</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Protection.impl.ProtectionEquipmentImpl#getLowLimit <em>Low Limit</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Protection.impl.ProtectionEquipmentImpl#getPowerDirectionFlag <em>Power Direction Flag</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Protection.impl.ProtectionEquipmentImpl#getRelayDelayTime <em>Relay Delay Time</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Protection.impl.ProtectionEquipmentImpl#getUnitMultiplier <em>Unit Multiplier</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Protection.impl.ProtectionEquipmentImpl#getUnitSymbol <em>Unit Symbol</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ProtectionEquipmentImpl extends EquipmentImpl implements ProtectionEquipment {
	/**
	 * The cached value of the '{@link #getHighLimit() <em>High Limit</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getHighLimit()
	 * @generated
	 * @ordered
	 */
	protected EA_Model.IEC61970.Domain.Float highLimit;

	/**
	 * The cached value of the '{@link #getLowLimit() <em>Low Limit</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLowLimit()
	 * @generated
	 * @ordered
	 */
	protected EA_Model.IEC61970.Domain.Float lowLimit;

	/**
	 * The cached value of the '{@link #getPowerDirectionFlag() <em>Power Direction Flag</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPowerDirectionFlag()
	 * @generated
	 * @ordered
	 */
	protected EA_Model.IEC61970.Domain.Boolean powerDirectionFlag;

	/**
	 * The cached value of the '{@link #getRelayDelayTime() <em>Relay Delay Time</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRelayDelayTime()
	 * @generated
	 * @ordered
	 */
	protected Seconds relayDelayTime;

	/**
	 * The default value of the '{@link #getUnitMultiplier() <em>Unit Multiplier</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getUnitMultiplier()
	 * @generated
	 * @ordered
	 */
	protected static final UnitMultiplier UNIT_MULTIPLIER_EDEFAULT = UnitMultiplier.P;

	/**
	 * The cached value of the '{@link #getUnitMultiplier() <em>Unit Multiplier</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getUnitMultiplier()
	 * @generated
	 * @ordered
	 */
	protected UnitMultiplier unitMultiplier = UNIT_MULTIPLIER_EDEFAULT;

	/**
	 * The default value of the '{@link #getUnitSymbol() <em>Unit Symbol</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getUnitSymbol()
	 * @generated
	 * @ordered
	 */
	protected static final UnitSymbol UNIT_SYMBOL_EDEFAULT = UnitSymbol.VA;

	/**
	 * The cached value of the '{@link #getUnitSymbol() <em>Unit Symbol</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getUnitSymbol()
	 * @generated
	 * @ordered
	 */
	protected UnitSymbol unitSymbol = UNIT_SYMBOL_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ProtectionEquipmentImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ProtectionPackage.Literals.PROTECTION_EQUIPMENT;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Float getHighLimit() {
		if (highLimit != null && highLimit.eIsProxy()) {
			InternalEObject oldHighLimit = (InternalEObject)highLimit;
			highLimit = (EA_Model.IEC61970.Domain.Float)eResolveProxy(oldHighLimit);
			if (highLimit != oldHighLimit) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProtectionPackage.PROTECTION_EQUIPMENT__HIGH_LIMIT, oldHighLimit, highLimit));
			}
		}
		return highLimit;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Float basicGetHighLimit() {
		return highLimit;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setHighLimit(EA_Model.IEC61970.Domain.Float newHighLimit) {
		EA_Model.IEC61970.Domain.Float oldHighLimit = highLimit;
		highLimit = newHighLimit;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProtectionPackage.PROTECTION_EQUIPMENT__HIGH_LIMIT, oldHighLimit, highLimit));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Float getLowLimit() {
		if (lowLimit != null && lowLimit.eIsProxy()) {
			InternalEObject oldLowLimit = (InternalEObject)lowLimit;
			lowLimit = (EA_Model.IEC61970.Domain.Float)eResolveProxy(oldLowLimit);
			if (lowLimit != oldLowLimit) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProtectionPackage.PROTECTION_EQUIPMENT__LOW_LIMIT, oldLowLimit, lowLimit));
			}
		}
		return lowLimit;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Float basicGetLowLimit() {
		return lowLimit;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setLowLimit(EA_Model.IEC61970.Domain.Float newLowLimit) {
		EA_Model.IEC61970.Domain.Float oldLowLimit = lowLimit;
		lowLimit = newLowLimit;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProtectionPackage.PROTECTION_EQUIPMENT__LOW_LIMIT, oldLowLimit, lowLimit));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Boolean getPowerDirectionFlag() {
		if (powerDirectionFlag != null && powerDirectionFlag.eIsProxy()) {
			InternalEObject oldPowerDirectionFlag = (InternalEObject)powerDirectionFlag;
			powerDirectionFlag = (EA_Model.IEC61970.Domain.Boolean)eResolveProxy(oldPowerDirectionFlag);
			if (powerDirectionFlag != oldPowerDirectionFlag) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProtectionPackage.PROTECTION_EQUIPMENT__POWER_DIRECTION_FLAG, oldPowerDirectionFlag, powerDirectionFlag));
			}
		}
		return powerDirectionFlag;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Boolean basicGetPowerDirectionFlag() {
		return powerDirectionFlag;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setPowerDirectionFlag(EA_Model.IEC61970.Domain.Boolean newPowerDirectionFlag) {
		EA_Model.IEC61970.Domain.Boolean oldPowerDirectionFlag = powerDirectionFlag;
		powerDirectionFlag = newPowerDirectionFlag;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProtectionPackage.PROTECTION_EQUIPMENT__POWER_DIRECTION_FLAG, oldPowerDirectionFlag, powerDirectionFlag));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Seconds getRelayDelayTime() {
		if (relayDelayTime != null && relayDelayTime.eIsProxy()) {
			InternalEObject oldRelayDelayTime = (InternalEObject)relayDelayTime;
			relayDelayTime = (Seconds)eResolveProxy(oldRelayDelayTime);
			if (relayDelayTime != oldRelayDelayTime) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProtectionPackage.PROTECTION_EQUIPMENT__RELAY_DELAY_TIME, oldRelayDelayTime, relayDelayTime));
			}
		}
		return relayDelayTime;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Seconds basicGetRelayDelayTime() {
		return relayDelayTime;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setRelayDelayTime(Seconds newRelayDelayTime) {
		Seconds oldRelayDelayTime = relayDelayTime;
		relayDelayTime = newRelayDelayTime;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProtectionPackage.PROTECTION_EQUIPMENT__RELAY_DELAY_TIME, oldRelayDelayTime, relayDelayTime));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public UnitMultiplier getUnitMultiplier() {
		return unitMultiplier;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setUnitMultiplier(UnitMultiplier newUnitMultiplier) {
		UnitMultiplier oldUnitMultiplier = unitMultiplier;
		unitMultiplier = newUnitMultiplier == null ? UNIT_MULTIPLIER_EDEFAULT : newUnitMultiplier;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProtectionPackage.PROTECTION_EQUIPMENT__UNIT_MULTIPLIER, oldUnitMultiplier, unitMultiplier));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public UnitSymbol getUnitSymbol() {
		return unitSymbol;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setUnitSymbol(UnitSymbol newUnitSymbol) {
		UnitSymbol oldUnitSymbol = unitSymbol;
		unitSymbol = newUnitSymbol == null ? UNIT_SYMBOL_EDEFAULT : newUnitSymbol;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProtectionPackage.PROTECTION_EQUIPMENT__UNIT_SYMBOL, oldUnitSymbol, unitSymbol));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ProtectionPackage.PROTECTION_EQUIPMENT__HIGH_LIMIT:
				if (resolve) return getHighLimit();
				return basicGetHighLimit();
			case ProtectionPackage.PROTECTION_EQUIPMENT__LOW_LIMIT:
				if (resolve) return getLowLimit();
				return basicGetLowLimit();
			case ProtectionPackage.PROTECTION_EQUIPMENT__POWER_DIRECTION_FLAG:
				if (resolve) return getPowerDirectionFlag();
				return basicGetPowerDirectionFlag();
			case ProtectionPackage.PROTECTION_EQUIPMENT__RELAY_DELAY_TIME:
				if (resolve) return getRelayDelayTime();
				return basicGetRelayDelayTime();
			case ProtectionPackage.PROTECTION_EQUIPMENT__UNIT_MULTIPLIER:
				return getUnitMultiplier();
			case ProtectionPackage.PROTECTION_EQUIPMENT__UNIT_SYMBOL:
				return getUnitSymbol();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ProtectionPackage.PROTECTION_EQUIPMENT__HIGH_LIMIT:
				setHighLimit((EA_Model.IEC61970.Domain.Float)newValue);
				return;
			case ProtectionPackage.PROTECTION_EQUIPMENT__LOW_LIMIT:
				setLowLimit((EA_Model.IEC61970.Domain.Float)newValue);
				return;
			case ProtectionPackage.PROTECTION_EQUIPMENT__POWER_DIRECTION_FLAG:
				setPowerDirectionFlag((EA_Model.IEC61970.Domain.Boolean)newValue);
				return;
			case ProtectionPackage.PROTECTION_EQUIPMENT__RELAY_DELAY_TIME:
				setRelayDelayTime((Seconds)newValue);
				return;
			case ProtectionPackage.PROTECTION_EQUIPMENT__UNIT_MULTIPLIER:
				setUnitMultiplier((UnitMultiplier)newValue);
				return;
			case ProtectionPackage.PROTECTION_EQUIPMENT__UNIT_SYMBOL:
				setUnitSymbol((UnitSymbol)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ProtectionPackage.PROTECTION_EQUIPMENT__HIGH_LIMIT:
				setHighLimit((EA_Model.IEC61970.Domain.Float)null);
				return;
			case ProtectionPackage.PROTECTION_EQUIPMENT__LOW_LIMIT:
				setLowLimit((EA_Model.IEC61970.Domain.Float)null);
				return;
			case ProtectionPackage.PROTECTION_EQUIPMENT__POWER_DIRECTION_FLAG:
				setPowerDirectionFlag((EA_Model.IEC61970.Domain.Boolean)null);
				return;
			case ProtectionPackage.PROTECTION_EQUIPMENT__RELAY_DELAY_TIME:
				setRelayDelayTime((Seconds)null);
				return;
			case ProtectionPackage.PROTECTION_EQUIPMENT__UNIT_MULTIPLIER:
				setUnitMultiplier(UNIT_MULTIPLIER_EDEFAULT);
				return;
			case ProtectionPackage.PROTECTION_EQUIPMENT__UNIT_SYMBOL:
				setUnitSymbol(UNIT_SYMBOL_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ProtectionPackage.PROTECTION_EQUIPMENT__HIGH_LIMIT:
				return highLimit != null;
			case ProtectionPackage.PROTECTION_EQUIPMENT__LOW_LIMIT:
				return lowLimit != null;
			case ProtectionPackage.PROTECTION_EQUIPMENT__POWER_DIRECTION_FLAG:
				return powerDirectionFlag != null;
			case ProtectionPackage.PROTECTION_EQUIPMENT__RELAY_DELAY_TIME:
				return relayDelayTime != null;
			case ProtectionPackage.PROTECTION_EQUIPMENT__UNIT_MULTIPLIER:
				return unitMultiplier != UNIT_MULTIPLIER_EDEFAULT;
			case ProtectionPackage.PROTECTION_EQUIPMENT__UNIT_SYMBOL:
				return unitSymbol != UNIT_SYMBOL_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (unitMultiplier: ");
		result.append(unitMultiplier);
		result.append(", unitSymbol: ");
		result.append(unitSymbol);
		result.append(')');
		return result.toString();
	}

} //ProtectionEquipmentImpl
